﻿<Window xmlns:my="clr-namespace:FxArchitect.Xna_3_1;assembly=FxArchitect.Xna_3_1"  x:Class="EffectArchitect.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:ad="clr-namespace:AvalonDock;assembly=AvalonDock"
        Title="MainWindow" Height="600" Width="800"
        Closing="Window_Closing" KeyDown="Window_KeyDown" KeyUp="Window_KeyUp">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="24" />
            <RowDefinition Height="*" />
            <RowDefinition Height="24" />
        </Grid.RowDefinitions>
        
        <Menu Grid.Row="0">
            <MenuItem Header="_File">
                <MenuItem Header="_New" Click="CreateNewEffect" />
                <MenuItem Header="_Open" Click="OpenExistingEffect" />
                <Separator />
                <MenuItem Header="_Save" Click="SaveCurrentEffect" />
                <MenuItem Header="Save As" Click="SaveCurrentEffectAs" />
                <Separator />
                <MenuItem Header="E_xit" Click="ExitProgram" />
            </MenuItem>
            <MenuItem Header="_View">
                <MenuItem Header="_Windows"
                            ItemsSource="{Binding DockableContents, ElementName=DockManager}"
                            Click="OnShowDockableContents">
                    <MenuItem.ItemTemplate>
                        <DataTemplate>
                            <TextBlock Text="{Binding Title}" />
                        </DataTemplate>
                    </MenuItem.ItemTemplate>
                </MenuItem>
                <MenuItem Header="_Layout">
                    <MenuItem Header="_Save" Click="OnSaveLayout" />
                    <MenuItem Header="_Load" Click="OnLoadLayout" />
                </MenuItem>
                <Separator />
                <MenuItem Header="Word Wrap" Click="ToggleWordWrap" />
                <MenuItem Header="Line Numbering" Click="ToggleLineNumbering" />
            </MenuItem>
            <MenuItem Header="_Help">
                <MenuItem Header="_About" Click="ShowAboutWindow" />
            </MenuItem>
        </Menu>

        <ad:DockingManager x:Name="DockManager" Grid.Row="1" 
                           Loaded="DockManager_Loaded"
                           ActiveDocumentChanged="DockManager_ActiveDocumentChanged">
            
            <ad:ResizingPanel Orientation="Vertical">
                <ad:ResizingPanel Orientation="Horizontal">
                    
                    <ad:DockablePane>
                        <ad:DockableContent x:Name="effectList" Title="Effects">
                            <TreeView x:Name="tvEffectList"></TreeView>
                        </ad:DockableContent>
                    </ad:DockablePane>
                    
                    <ad:DocumentPane x:Name="documents" />
                    
                    <ad:DockablePane>
                        <ad:DockableContent x:Name="preview" Title="Preview">
                            <my:RenderSurface x:Name="renderSurface" />
                        </ad:DockableContent>
                    </ad:DockablePane>
                    
                </ad:ResizingPanel>
                
                <ad:DockablePane ad:ResizingPanel.ResizeHeight="100">
                    <ad:DockableContent Title="Errors and Warnings" x:Name="errors">
                        <ListView x:Name="lvErrorsAndWarnings"
                                  MouseDoubleClick="GotoErrorLocation">
                            <ListView.View>
                                <GridView>
                                    <GridView.Columns>
                                        <GridViewColumn Header="Type" DisplayMemberBinding="{Binding Path=Type}" />
                                        <GridViewColumn Header="Description" DisplayMemberBinding="{Binding Path=Description}" />
                                        <GridViewColumn Header="File" DisplayMemberBinding="{Binding Path=File}" />
                                        <GridViewColumn Header="Line" DisplayMemberBinding="{Binding Path=Line}" />
                                        <GridViewColumn Header="Column" DisplayMemberBinding="{Binding Path=Column}" />
                                        <GridViewColumn Header="Root" DisplayMemberBinding="{Binding Path=Root}" />
                                    </GridView.Columns>
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </ad:DockableContent>
                    <ad:DockableContent Title="Output" x:Name="output">
                        <TextBox x:Name="tbOutput" IsReadOnly="True" AcceptsReturn="True" />
                    </ad:DockableContent>
                </ad:DockablePane>
            </ad:ResizingPanel>
            
        </ad:DockingManager>

        <StatusBar Grid.Row="2">
            <StatusBarItem x:Name="appStatus" Content="Ready" />
        </StatusBar>
        
    </Grid>
</Window>
